<template>
	<div class="ali-pay">
		<Loading v-if="loading"></Loading>
		<!-- 支付宝会返回一个html代码 是一个表单form 只要提交这个表单就可以实现支付宝支付 -->
		<div class="form" v-html="content"></div>
	</div>
</template>

<script>
	import Loading from '../components/Loading.vue'
	export default{
		components:{
			Loading
		},
		data(){
			return{
				orderId:this.$route.query.orderId,
				content:'',
				loading:true
			}
		},
		created() {
			this.paySubmit()
		},
		methods:{
			paySubmit(){
				this.axios.post('/pay',{
					orderId:this.orderId,
					orderName:'vue高仿小米商城',
					amount:0.01,
					payType:1
				}).then(res=>{
					this.content=res.content;
					setTimeout(()=>{
						document.forms[0].submit()
					},100)
				})
			}
		}
	}
</script>

<style>
</style>
